package tasks.OpportunitiesBaseData.MainView;
import java.awt.Point;

import ibm.widgets.WLink;
import ibm.widgets.WTable;
import resources.tasks.OpportunitiesBaseData.MainView.DrillThroughHelper;
import appobjects.OpportunitiesBaseDataView.Cognos.MainView;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.testcases.TestObj;
/**
 * Description   : Functional Test Script
 * @author angel.tsvetkov
 */
public class DrillThrough extends DrillThroughHelper
{
	public boolean execute(int rowNumber)
	{
		boolean result = true;
    	int dtlKeyOrder = 12;
		MainView mainView = new MainView();
		WTable mainViewTable = mainView.get();
		
		try
		{
			TestObject xpath = mainViewTable.getChildren()[0].getChildren()[rowNumber].getChildren()[dtlKeyOrder].getChildren()[0];
			WLink dtlNoSTG = new WLink(xpath);
			dtlNoSTG.click();
		}
		catch(IndexOutOfBoundsException ex)
		{
			result = false;
			setErrorComment("The record is not exists!");
		}
		
		return result;
	}
}

